﻿

    function addFeed (message, targetId, fnSuccess, fnFail, url) {
        var params = {};
        params[opensocial.Activity.Field.TITLE] = message;
        if (url) params[opensocial.Activity.Field.URL] = url;
        if (targetId) {
            //alert('targetId: '+targetId);
            if (isRelease) params[mixi.ActivityField.RECIPIENTS] = [targetId];
        }
        var activity = opensocial.newActivity(params);
        
        opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, function(response){
            if (response.hadError()) {
                //console.log(''+response.getErrorCode());
                fnFail();
            }
            else fnSuccess();
        });
    }
    
    function addMessage (message) {
        $('.error_area').empty();
        $('.message_area').text(message);
    }

    function addError (message) {
        $('.message_area').empty();
        $('.error_area').text(message);
    }
